package com.itheima.service.impl;

import com.itheima.dao.BookDao;
import com.itheima.dao.UserDao;
import com.itheima.service.BookService;

/**
 * @author: dh
 * @date: 2023-10-24 19:13
 */
public class BookServiceImpl implements BookService {

    private BookDao bookDao;

    // 1.声明UserDao属性
    private UserDao userDao;

    public BookServiceImpl(BookDao bookDao) {

        this.bookDao = bookDao;
    }

    // 2.生成一个带有bookDao和userDao参数的构造函数
    public BookServiceImpl(BookDao bookDao, UserDao userDao) {

        this.bookDao = bookDao;
        this.userDao = userDao;
    }

    @Override
    public void save() {

        bookDao.save();
        userDao.save();
        System.out.println("book service save ...");
    }

//    1.将bookDao的setter方法删除掉
//    public void setBookDao(BookDao bookDao) {
//
//        this.bookDao = bookDao;
//    }
}
